import request from '@/utils/Request'

// 查询商户列表
export function listMerchant(query: any) {
  return request({
    url: '/merchant/fetch',
    method: 'get',
    params: query
  })
}

// 查询商户树列表
export function listMerchantTree(query: any) {
  return request({
    url: '/merchant/tree',
    method: 'get',
    params: query
  })
}

// 查询商户详细信息
export function getMerchant(id: string) {
  return request({
    url: `/merchant/get/${id}`,
    method: 'get',
  })
}

// 新增商户
export function saveMerchant(data: any) {
  return request({
    url: '/merchant/save',
    method: 'post',
    data: data
  })
}

// 修改商户
export function updateMerchant(data: any) {
  return request({
    url: '/merchant/update',
    method: 'put',
    data: data
  })
}

// 删除商户
export function delMerchant(ids: any) {
  return request({
    url: '/merchant/delete',
    method: 'delete',
    data: {
      listIds: ids instanceof Array ? ids : [ids]
    }
  })
}